package main

import (
	"fmt"
	"log"

	r "gopkg.in/rethinkdb/rethinkdb-go.v5"
)

// User return user
type User struct {
	CreatedAt      string
	Email          string
	LastLoggedInAt string
	SecretKey      string
	Username       string
}

func main() {
	session, err := r.Connect(r.ConnectOpts{
		Address: "10.64.57.168",
		Database: "atxserver2"
	})

	if err != nil {
		log.Fatalln(err)
	}

	res, err := r.Expr("Hello World").Run(session)

	if err != nil {
		log.Fatalln(err)
	}

	var response string
	err = res.One(&response)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println(response)

	var user User
	res, err := r.Table("users").Get().Run(session)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println(res)

	defer res.Close()

}
